/* 场馆相关 */
import ajax from '@/libs/ajax'
const pubController = '/pub/sportsVenue'
/**
 * 运动类目
 * @param {*} data 数据
 */
const API_SPORT_TYPES = (data) => ajax(`/pub/sportsType/getAllSportsType`, 'get', data)

/**
 * 附近场馆
 * @param {*} data
 */
const API_VENUES_NEARBY = (data) => ajax(`${pubController}/getNearVenueByCurrentLoaction`, 'get', data)

/**
 * 搜索
 * @param {*} data
 */
const API_VENUES_SEARCH = (data) => ajax('/pub/sportsVenue/fuzzyQueryVenuePagingByName', 'get', data)

/**
 * 场馆列表
 * @param {*} data
 */
const API_VENUES_LIST = (data) => ajax(`${pubController}/venuePaging`, 'get', data)

/**
 * 场馆详情
 * @param {*} data
 */
const API_VENUES_DETAIL = (data) => ajax(`${pubController}/getSportsVenueById`, 'get', data)

/**
 * 场馆评价
 * @param {*} data
 */
const API_VENUE_COMMENTS = (data) => ajax('/pub/orderCommon/getOrderCommontByVenueId', 'get', data)

/**
 * 场地时间表
 * @param {*} data
 */
const API_FIELD_DETAIL = (data) => ajax('/pub/venueItem/getVenueItemOrderInfoByItemId', 'get', data)

/**
 * 根据场地日期查询时间点
 * @param {*} data
 */
const API_FIELD_TICKETS = (data) => ajax('/pub/ticketPrice/getTickets', 'get', data)

/**
 * 预定
 * @param {*} data
 */
const API_BOOKING_ORDER = (data) => ajax('/v1/orderInfo/newBookingOrder', 'post', data)

/* --- 订单相关 --- */
const API_ORDER_DETAIL = (id) => ajax('/v1/orderInfo/getOrderInfoById', 'post', { orderId: id })

const API_ORDER_COMMENT = (data) => ajax('/v1/orderCommont/addOrderCommont', 'post', data)

const API_ORDER_CLOSE = (data) => ajax('/v1/orderInfo/closeOrder', 'post', data)

const API_ORDER_ISREVERSE = (id) => ajax('/v1/orderInfo/isReversibility', 'post', { orderId: id })

export {
  API_SPORT_TYPES,
  API_VENUES_NEARBY,
  API_VENUES_SEARCH,
  API_VENUES_LIST,
  API_VENUES_DETAIL,
  API_VENUE_COMMENTS,
  API_FIELD_DETAIL,
  API_FIELD_TICKETS,
  API_BOOKING_ORDER,
  API_ORDER_DETAIL,
  API_ORDER_COMMENT,
  API_ORDER_CLOSE,
  API_ORDER_ISREVERSE
}
